package com.lee.blog.service;

import com.lee.blog.bean.Article;
import com.lee.blog.mapper.ArticleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArticleService {

    @Autowired
    ArticleMapper articleMapper;

    public List<Article> getHomeArticle(int start, int itemCount){
        return articleMapper.getHomeArticle(start, itemCount);
    }

    public List<Article> getNewArticle(){
        return articleMapper.getNewArticle();
    }

    public int getArticleCount(){
        return articleMapper.getArticleCount();
    }

    public void writeArticle(Article article){
        articleMapper.writeArticle(article);
    }

    public Article getArticleById(int id){
        return articleMapper.getArticleById(id);
    }

    public List<Article> getTechnologyArticle(){
        return articleMapper.getTechnologyArticle();
    }

    public List<Article> getLifeArticle(){
        return articleMapper.getLifeArticle();
    }

    public List<Article> getAllArticle(){
        return articleMapper.getAllArticle();
    }

    public void doEdit(Article article){
        articleMapper.doEdit(article);
    }

    public void deleteArticleById(int id){
        articleMapper.deleteArticleById(id);
    }

    public List<String> getAllLabel(){
        return articleMapper.getAllLabel();
    }

    public List<Article> getArticleByLabel(String label){
        return articleMapper.getArticleByLabel(label);
    }
}
